package cn.mpq.payment.controller;


import cn.mpq.payment.Utils.MailUtil;
import cn.mpq.payment.common.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class MailController {
    @Autowired
    private Environment env;

    @RequestMapping(value = "send")
    public Result send(String subject,String sendHtml,String receiveUser){
  /*      String subject = "嗨咯";
        String sendHtml = "测试发送邮箱功能";
        String receiveUser = "1145801282@qq.com";*/
        MailUtil.receiveEmail(env.getProperty("mail.from"),env.getProperty("mail.host"),env.getProperty("mail.password"));
        return MailUtil.sendEmail(subject,sendHtml,receiveUser);
    }

}